package com.jt.demo.controller;

import com.jt.demo.mapper.UserMapper;
import com.jt.demo.pojo.User;
import com.jt.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserControllerImpl{
    @Autowired
    private UserService userService;
    @GetMapping("/findAll")
    public List<User> findAll(){
        return userService.findAll();
    }
   @GetMapping ("/deleteUserById")
    public void deleteUserById(Integer id){
         userService.deleteUserById(id);
   }
   @PostMapping("/insertUser")
    public void insertUser(@RequestBody User user){
        userService.insertUser(user);
   }
}
